import Vue from 'vue'
import Vuex from 'vuex'
import { getToken, setToken, removeToken } from '@/api/axios.auth'
Vue.use(Vuex)

export default new Vuex.Store({
  state : {
    is_login : 0,
    token : getToken()
  },
  mutations : {
    changeLogin (state, status) {
        state.isLogin = status
    },
    SET_TOKEN: (state, token) => {
      state.token = token
    }
  },
  actions : {
    changeLogin (state, status) {
        state.isLogin = status
        setToken('2222')
    },
    loginOut () {
      removeToken()
    }
  }
})
